#ifndef _SOUND_H_
#define _SOUND_H_

#include <QtGui>
#include <QtCore>

#include "fmod.hpp"

class FMOD_Sound
{
public:
	FMOD_Sound(int maxChannels = DEFAULT_MAX_CHANNELS);
	~FMOD_Sound(void);

	enum Effect
	{
		Reverb,
		Pitch,
		Distortion,
		Echo,
		Flange
	};

	void loadSound(QString soundName, QString soundFilePath);
	void unloadSound(QString soundName);

	void addEffect(Effect effectType, QString soundName, float value);
	void removeEffect(Effect effectType, QString soundName);

	void playSound(QString soundName, float volume);
	void stopSound(QString soundName);

	float getVolume(QString soundName);

	void setVolume(QString soundName, float volume);
	void setPaused(QString soundName, bool state);
	void setEffectValue(QString soundName, Effect type, float newValue);

private:
	FMOD::System * system;

	QMap<QString, FMOD::Channel *> channelMap;
	QMap<QString, FMOD::Sound *> soundMap;

	QMap<QString, FMOD::DSP *> reverbMap;
	QMap<QString, FMOD::DSP *> pitchMap;
	QMap<QString, FMOD::DSP *> flangeMap;
	QMap<QString, FMOD::DSP *> echoMap;
	QMap<QString, FMOD::DSP *> distortionMap;

	static const int DEFAULT_MAX_CHANNELS = 128;
};

#endif //_SOUND_H_
